package leaveSystem.model;

import java.io.Serializable;
import java.util.Date;
public class Employee implements Cloneable, Serializable {

    private int employeeId;
    public int roleId;
    private String employeeRank;
    private String name;
    private String username;
    private String password;
    private String officialEmail;
    private int managerId;
    private String createdBy;
    private Date createdTimeStamp;
    private String updatedBy;
    private Date updatedTimeStamp;
    public boolean valid;

    public Employee () {

    }

    public Employee (int employeeIdIn) {

          this.employeeId = employeeIdIn;

    }

    public int getEmployeeId() {
          return this.employeeId;
    }
    public void setEmployeeId(int employeeIdIn) {
          this.employeeId = employeeIdIn;
    }

    public int getRoleId() {
          return this.roleId;
    }
    public void setRoleId(int roleIdIn) {
          this.roleId = roleIdIn;
    }

    public String getEmployeeRank() {
          return this.employeeRank;
    }
    public void setEmployeeRank(String employeeRankIn) {
          this.employeeRank = employeeRankIn;
    }

    public String getName() {
          return this.name;
    }
    public void setName(String nameIn) {
          this.name = nameIn;
    }

    public String getUsername() {
          return this.username;
    }
    public void setUsername(String usernameIn) {
          this.username = usernameIn;
    }

    public String getPassword() {
          return this.password;
    }
    public void setPassword(String passwordIn) {
          this.password = passwordIn;
    }

    public String getOfficialEmail() {
          return this.officialEmail;
    }
    public void setOfficialEmail(String officialEmailIn) {
          this.officialEmail = officialEmailIn;
    }

    public int getManagerId() {
          return this.managerId;
    }
    public void setManagerId(int managerIdIn) {
          this.managerId = managerIdIn;
    }

    public String getCreatedBy() {
          return this.createdBy;
    }
    public void setCreatedBy(String createdByIn) {
          this.createdBy = createdByIn;
    }

    public Date getCreatedTimeStamp() {
          return this.createdTimeStamp;
    }
    public void setCreatedTimeStamp(Date createdTimeStampIn) {
          this.createdTimeStamp = createdTimeStampIn;
    }

    public String getUpdatedBy() {
          return this.updatedBy;
    }
    public void setUpdatedBy(String updatedByIn) {
          this.updatedBy = updatedByIn;
    }

    public Date getUpdatedTimeStamp() {
          return this.updatedTimeStamp;
    }
    public void setUpdatedTimeStamp(Date updatedTimeStampIn) {
          this.updatedTimeStamp = updatedTimeStampIn;
    }
    public boolean isValid() {
        return valid;
	}

     public void setValid(boolean newValid) {
        valid = newValid;
	}	

    public void setAll(int employeeIdIn,
          int roleIdIn,
          String employeeRankIn,
          String nameIn,
          String usernameIn,
          String passwordIn,
          String officialEmailIn,
          int managerIdIn,
          String createdByIn,
          Date createdTimeStampIn,
          String updatedByIn,
          Date updatedTimeStampIn) {
          this.employeeId = employeeIdIn;
          this.roleId = roleIdIn;
          this.employeeRank = employeeRankIn;
          this.name = nameIn;
          this.username = usernameIn;
          this.password = passwordIn;
          this.officialEmail = officialEmailIn;
          this.managerId = managerIdIn;
          this.createdBy = createdByIn;
          this.createdTimeStamp = createdTimeStampIn;
          this.updatedBy = updatedByIn;
          this.updatedTimeStamp = updatedTimeStampIn;
    }

    public boolean hasEqualMapping(Employee valueObject) {

          if (valueObject.getEmployeeId() != this.employeeId) {
                    return(false);
          }
          if (valueObject.getRoleId() != this.roleId) {
                    return(false);
          }
          if (this.employeeRank == null) {
                    if (valueObject.getEmployeeRank() != null)
                           return(false);
          } else if (!this.employeeRank.equals(valueObject.getEmployeeRank())) {
                    return(false);
          }
          if (this.name == null) {
                    if (valueObject.getName() != null)
                           return(false);
          } else if (!this.name.equals(valueObject.getName())) {
                    return(false);
          }
          if (this.username == null) {
                    if (valueObject.getUsername() != null)
                           return(false);
          } else if (!this.username.equals(valueObject.getUsername())) {
                    return(false);
          }
          if (this.password == null) {
                    if (valueObject.getPassword() != null)
                           return(false);
          } else if (!this.password.equals(valueObject.getPassword())) {
                    return(false);
          }
          if (this.officialEmail == null) {
                    if (valueObject.getOfficialEmail() != null)
                           return(false);
          } else if (!this.officialEmail.equals(valueObject.getOfficialEmail())) {
                    return(false);
          }
          if (valueObject.getManagerId() != this.managerId) {
                    return(false);
          }
          if (this.createdBy == null) {
                    if (valueObject.getCreatedBy() != null)
                           return(false);
          } else if (!this.createdBy.equals(valueObject.getCreatedBy())) {
                    return(false);
          }
          if (this.createdTimeStamp == null) {
                    if (valueObject.getCreatedTimeStamp() != null)
                           return(false);
          } else if (!this.createdTimeStamp.equals(valueObject.getCreatedTimeStamp())) {
                    return(false);
          }
          if (this.updatedBy == null) {
                    if (valueObject.getUpdatedBy() != null)
                           return(false);
          } else if (!this.updatedBy.equals(valueObject.getUpdatedBy())) {
                    return(false);
          }
          if (this.updatedTimeStamp == null) {
                    if (valueObject.getUpdatedTimeStamp() != null)
                           return(false);
          } else if (!this.updatedTimeStamp.equals(valueObject.getUpdatedTimeStamp())) {
                    return(false);
          }

          return true;
    }


    public String toString() {
        StringBuffer out = new StringBuffer(this.getDaogenVersion());
        out.append("\nclass Employee, mapping to table employee\n");
        out.append("Persistent attributes: \n"); 
        out.append("employeeId = " + this.employeeId + "\n"); 
        out.append("roleId = " + this.roleId + "\n"); 
        out.append("employeeRank = " + this.employeeRank + "\n"); 
        out.append("name = " + this.name + "\n"); 
        out.append("username = " + this.username + "\n"); 
        out.append("password = " + this.password + "\n"); 
        out.append("officialEmail = " + this.officialEmail + "\n"); 
        out.append("managerId = " + this.managerId + "\n"); 
        out.append("createdBy = " + this.createdBy + "\n"); 
        out.append("createdTimeStamp = " + this.createdTimeStamp + "\n"); 
        out.append("updatedBy = " + this.updatedBy + "\n"); 
        out.append("updatedTimeStamp = " + this.updatedTimeStamp + "\n"); 
        return out.toString();
    }

    public Object clone() {
        Employee cloned = new Employee();

        cloned.setEmployeeId(this.employeeId); 
        cloned.setRoleId(this.roleId); 
        if (this.employeeRank != null)
             cloned.setEmployeeRank(new String(this.employeeRank)); 
        if (this.name != null)
             cloned.setName(new String(this.name)); 
        if (this.username != null)
             cloned.setUsername(new String(this.username)); 
        if (this.password != null)
             cloned.setPassword(new String(this.password)); 
        if (this.officialEmail != null)
             cloned.setOfficialEmail(new String(this.officialEmail)); 
        cloned.setManagerId(this.managerId); 
        if (this.createdBy != null)
             cloned.setCreatedBy(new String(this.createdBy)); 
        if (this.createdTimeStamp != null)
             cloned.setCreatedTimeStamp((Date)this.createdTimeStamp.clone()); 
        if (this.updatedBy != null)
             cloned.setUpdatedBy(new String(this.updatedBy)); 
        if (this.updatedTimeStamp != null)
             cloned.setUpdatedTimeStamp((Date)this.updatedTimeStamp.clone()); 
        return cloned;
    }

    public String getDaogenVersion() {
        return " ";
    }

}
